/*
(function($){  
	    var status = false;  
	    $.fn.scrollQ = function(options){  
	        var defaults = {  
	            line:4,  
	            scrollNum:2,  
	            scrollTime:2000
	        };
			var options=jQuery.extend(defaults,options);
			var _self = this;
			return this.each(function(){  
				$("li",this).each(function(){
					$(this).css("display","none");
				});
				$("li:lt("+options.line+")",this).each(function(){
					$(this).css("display","block");
				});
				function scroll() {
					for(i=0;i<options.scrollNum;i++) {
						var start=$("li:first",_self);
						start.fadeOut(100);
						start.css("display","none");
						start.appendTo(_self);
						$("li:eq("+(options.line-1)+")",_self).each(function(){
							$(this).fadeIn(500);
							$(this).css("display","block");
						});
					}
				}
				var timer;
				timer = setInterval(scroll,options.scrollTime);
				_self.bind("mouseover",function(){
					clearInterval(timer);
				});
				_self.bind("mouseout",function(){
					timer = setInterval(scroll,options.scrollTime);
				});
				
			});
	    };
	})(jQuery); 
*/	
	jQuery.fn.rollup=function(option){
		var setting={wo:Object,so:Object,stopBorder:false,speed:100,wait:1000,quick:5,oldHeight:0,timer:null,flag:-1,ispause:false};
		if(option){$.extend(setting,option);}
		this.hover(function(){
						clearTimeout(setting.timmer);
						setting.timmer=null;
						setting.ispause=true;
						setting.timmer=setTimeout(function(){that.roll(1);},setting.speed);
					}
					,function(){
						clearTimeout(setting.timmer);
						setting.timmer=null;
						setting.ispause=false;
						setting.timmer=setTimeout(function(){that.roll();},setting.wait);
					});
		this.bind("mousemove",function(e){setting.flag=e.pageY-setting.wo.offset().top>setting.wo.height()/2?-1:1;});	
		setting.oldHeight=$(this).outerHeight();	
		$(this).append($(this).html());
		var that = this;	
		this.roll=function(ext){		
			if(ext||!setting.ispause){
				if(setting.timmer){
					clearTimeout(setting.timmer);
					setting.timmer=null;
				}			
				var t=getNum($(that).css('top'));			
				var d=new Date();			
					
				if(t>=setting.oldHeight*-1){
					if(ext&&setting.stopBorder){
						var h=$(setting.so).outerHeight();
						h += getNum($(setting.so).css("margin-top"))*1;
						h += getNum($(setting.so).css("margin-bottom"))*1;					
						if(t%h!=0){
							$(that).css("top",t-0+1*setting.flag+"px");
							setting.timmer=setTimeout(function(){that.roll(1);},setting.quick);
						}
					}else{
						$(that).css("top",t-1+"px");
						setting.timmer=setTimeout(function(){that.roll();},setting.speed);
					}
				}else{
					$(that).css("top","0px");
					that.roll();
				}
			}else{
				setting.timmer=setTimeout(function(){that.roll();},setting.speed);			
				return false;
			}
			function getNum(str){
				var tmp = str.replace(/px|PX|auto|AUTO/g,"");			
				return tmp==""?0:tmp;
			}
		};	
		this.roll();
		
	};